package com.idp.common.utils;

public class ConverterUtils {
    /**
     * Converts a given string to an Integer.
     *
     * @param str the string to convert
     * @return the converted integer, or 0 if the string is null, empty, or not a valid integer
     */
    public static Integer convert(String str) {
        if (str == null || str.trim().isEmpty()) {
            return 0;
        }
        try {
            return Integer.parseInt(str.trim());
        } catch (NumberFormatException e) {
            return 0;
        }
    }

}
